import 'package:fluro/fluro.dart';
import 'package:flutter_base/views/login/LoginInfoPage.dart';
import 'package:flutter_base/views/login/LoginPage.dart';
import 'package:flutter_base/views/login/UserInfo.dart';
import 'package:flutter_base/utils/route/IRouter.dart';

class LoginRouter extends IRouter{


   static String loginPage = "/login/loginPage";
   static String loginUserInfoPage = "/login/loginUserInfoPage";

  @override
  void initFluroRouter(FluroRouter fluroRouter) {
    // TODO: implement initFluroRouter
    fluroRouter.define(loginPage, handler: Handler(handlerFunc: (_,params){
        String? userName = params[LoginPage.bundleKeyUserName]?.first;
        String? times = params[LoginPage.bundleKeyTime]?.first;
        // ! 非空
        return LoginPage(userName!, times!);
    }));

    fluroRouter.define(loginUserInfoPage, handler: Handler(handlerFunc: (context,params){
      final args = context?.settings?.arguments as UserInfo;
      return LoginInfoPage(args);
    }));
  }

}